home *** CD-ROM | disk | FTP | other *** search
/ Linux Cubed Series 7: Sunsite / Linux Cubed Series 7 - Sunsite Vol 1.iso / system / shells / scsh-0.4 / scsh-0 / scsh-0.4.2 / scsh / hpux / tty-consts.scm < prev    next >
Text File  |  1995-10-31  |  9KB  |  229 lines

  1. ;;; Constant definitions for tty control code (POSIX termios).
  2. ;;; Copyright (c) 1995 by Brian Carlstrom.
  3. ;;; Largely rehacked by Olin.
  4.  
  5. ;;; These constants are for HP-UX, 
  6. ;;; and are taken from /usr/include/sys/termio.h.
  7.  
  8. ;;; Non-standard (POSIX, SVR4, 4.3+BSD) things:
  9. ;;; - Some of the baud rates.
  10.  
  11.  
  12. ;;; Special Control Characters 
  13. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  14. ;;;  Indices into the c_cc[] character array.
  15.  
  16. ;;;    Name                 Subscript    Enabled by 
  17. ;;;     ----                 ---------    ----------
  18. ;;;  POSIX
  19. (define ttychar/eof        4)        ; ^d icanon
  20. (define ttychar/eol        5)        ;    icanon
  21. (define ttychar/delete-char    2)        ; ^? icanon
  22. (define ttychar/delete-line    3)        ; ^u icanon
  23. (define ttychar/interrupt    0)        ; ^c isig
  24. (define ttychar/quit        1)        ; ^\ isig
  25. (define ttychar/suspend        13)        ; ^z isig
  26. (define ttychar/start        14)        ; ^q ixon, ixoff
  27. (define ttychar/stop        15)        ; ^s ixon, ixoff
  28. (define ttychar/min        11)        ;    !icanon    ; Not exported
  29. (define ttychar/time        12)        ;    !icanon    ; Not exported
  30.  
  31. ;;; SVR4 & 4.3+BSD
  32. (define ttychar/delete-word    #f)        ; ^w icanon
  33. (define ttychar/reprint     #f)        ; ^r icanon
  34. (define ttychar/literal-next    #f)        ; ^v iexten
  35. (define ttychar/discard        #f)        ; ^o iexten
  36. (define ttychar/delayed-suspend    #f)        ; ^y isig
  37. (define ttychar/eol2        #f)        ;    icanon
  38.  
  39. ;;; 4.3+BSD
  40. (define ttychar/status        #f)        ; ^t icanon 
  41.  
  42. ;;; Length of control-char string -- *Not Exported*
  43. (define    num-ttychars        16)
  44.  
  45. ;;; Magic "disable feature" tty character
  46. (define disable-tty-char (ascii->char #xff))    ; _POSIX_VDISABLE
  47.  
  48. ;;; HP-UX brain death:
  49. ;;; HP-UX defines NCCS to be 16, then sneaks the DSUSP char (^y) in as
  50. ;;; a seventeenth char -- there's another non-standard NLDCC constant
  51. ;;; defined to be 1+16 that's used elsewhere. Since the scsh interface
  52. ;;; to tcsetattr() uses a char vec of size NCCS, you can't get at this
  53. ;;; hidden char. So we do not support the delayed-suspension char; sorry.
  54. ;;;
  55. ;;; If you are an HP-UX hacker, and know a way to fix this, let me know.
  56.  
  57. ;;; Flags controllling input processing
  58. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  59.  
  60. ;;;  POSIX
  61. (define ttyin/ignore-break        #o00001)    ; ignbrk
  62. (define ttyin/interrupt-on-break    #o00002)    ; brkint
  63. (define ttyin/ignore-bad-parity-chars    #o00004)    ; ignpar
  64. (define ttyin/mark-parity-errors    #o00010)    ; parmrk
  65. (define ttyin/check-parity        #o00020)    ; inpck
  66. (define ttyin/7bits            #o00040)    ; istrip
  67. (define ttyin/nl->cr            #o00100)    ; inlcr
  68. (define ttyin/ignore-cr            #o00200)    ; igncr
  69. (define ttyin/cr->nl            #o00400)    ; icrnl
  70. (define ttyin/output-flow-ctl        #o02000)    ; ixon
  71. (define ttyin/input-flow-ctl        #o10000)    ; ixoff
  72.  
  73. ;;; SVR4 & 4.3+BSD
  74. (define ttyin/xon-any           #o4000)    ; ixany: Any char restarts after stop
  75. (define ttyin/beep-on-overflow #f)    ; imaxbel: queue full => ring bell
  76.  
  77. ;;; SVR4
  78. (define ttyin/lowercase           #o1000)    ; iuclc: Map upper-case to lower case
  79.  
  80.  
  81. ;;; Flags controlling output processing
  82. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  83.  
  84. ;;;  POSIX 
  85. (define    ttyout/enable         #o000001)  ; opost: enable output processing
  86.  
  87. ;;; SVR4 & 4.3+BSD
  88. (define ttyout/nl->crnl         #o000004)    ; onlcr: map nl to cr-nl
  89.  
  90. ;;; 4.3+BSD
  91. (define ttyout/discard-eot     #f)        ; onoeot
  92. (define ttyout/expand-tabs     #f)        ; oxtabs (NOT xtabs)
  93.  
  94. ;;; SVR4
  95. (define ttyout/cr->nl         #o000010)    ; ocrnl
  96. (define ttyout/fill-w/del     #o000200)    ; ofdel
  97. (define ttyout/delay-w/fill-char #o000100)    ; ofill
  98. (define ttyout/uppercase     #o000002)    ; olcuc
  99. (define ttyout/nl-does-cr     #o000040)    ; onlret
  100. (define ttyout/no-col0-cr     #o000020)    ; onocr
  101.  
  102. ;;; Newline delay
  103. (define    ttyout/nl-delay        #o000400)    ; mask (nldly)
  104. (define     ttyout/nl-delay0    #o000000)
  105. (define     ttyout/nl-delay1    #o000400)    ; tty 37 
  106.  
  107. ;;; Horizontal-tab delay
  108. (define    ttyout/tab-delay    #o014000)    ; mask (tabdly)
  109. (define     ttyout/tab-delay0    #o000000)
  110. (define     ttyout/tab-delay1    #o004000)    ; tty 37 
  111. (define     ttyout/tab-delay2    #o010000)
  112. (define     ttyout/tab-delayx    #o014000)    ; Expand tabs (xtabs, tab3)
  113.  
  114. ;;; Carriage-return delay
  115. (define    ttyout/cr-delay        #o003000)    ; mask (crdly)
  116. (define     ttyout/cr-delay0    #o000000)
  117. (define     ttyout/cr-delay1    #o001000)    ; tn 300 
  118. (define     ttyout/cr-delay2    #o002000)    ; tty 37 
  119. (define     ttyout/cr-delay3    #o003000)    ; concept 100 
  120.  
  121. ;;; Vertical tab delay 
  122. (define    ttyout/vtab-delay    #o040000)    ; mask (vtdly)
  123. (define     ttyout/vtab-delay0    #o000000)
  124. (define     ttyout/vtab-delay1    #o040000)    ; tty 37 
  125.  
  126. ;;; Backspace delay
  127. (define    ttyout/bs-delay        #o020000)    ; mask (bsdly)
  128. (define     ttyout/bs-delay0    #o000000)
  129. (define     ttyout/bs-delay1    #o020000)
  130.  
  131. ;;; Form-feed delay
  132. (define ttyout/ff-delay        #o100000)    ; mask (ffdly)
  133. (define     ttyout/ff-delay0    #o000000)
  134. (define     ttyout/ff-delay1    #o100000)
  135.  
  136. (define    ttyout/all-delay
  137.   (bitwise-ior (bitwise-ior (bitwise-ior ttyout/nl-delay ttyout/tab-delay)
  138.                 (bitwise-ior ttyout/cr-delay ttyout/vtab-delay))
  139.            (bitwise-ior ttyout/bs-delay ttyout/ff-delay)))
  140.  
  141.  
  142. ;;; Control flags - hacking the serial-line.
  143. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  144.  
  145. ;;;  POSIX
  146. (define ttyc/char-size        #o00140)    ; csize: character size mask 
  147. (define  ttyc/char-size5    #o00000)    ; 5 bits (cs5)
  148. (define  ttyc/char-size6    #o00040)    ; 6 bits (cs6)
  149. (define  ttyc/char-size7    #o00100)    ; 7 bits (cs7)
  150. (define  ttyc/char-size8    #o00140)    ; 8 bits (cs8)
  151. (define ttyc/2-stop-bits    #o00200)    ; cstopb: Send 2 stop bits.
  152. (define ttyc/enable-read    #o00400)    ; cread: Enable receiver.
  153. (define ttyc/enable-parity    #o01000)    ; parenb
  154. (define ttyc/odd-parity        #o02000)    ; parodd
  155. (define ttyc/hup-on-close    #o04000)    ; hupcl: Hang up on last close.
  156. (define ttyc/no-modem-sync    #o10000)    ; clocal: Ignore modem lines.
  157.  
  158. ;;;  4.3+BSD
  159. (define    ttyc/ignore-flags     #f)    ; cignore: ignore control flags 
  160. (define ttyc/CTS-output-flow-ctl #f)    ; ccts_oflow: CTS flow control of output
  161. (define ttyc/RTS-input-flow-ctl  #f)    ; crts_iflow: RTS flow control of input
  162. (define ttyc/carrier-flow-ctl     #f)    ; mdmbuf
  163.  
  164. ;;; Local flags -- hacking the tty driver / user interface.
  165. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  166.  
  167. ;;;  POSIX
  168. (define ttyl/visual-delete    #o020)    ; echoe: Visually erase chars
  169. (define ttyl/echo-delete-line #o040)    ; echok: Echo nl after line kill
  170. (define ttyl/echo          #o010)    ; echo:  Enable echoing
  171. (define ttyl/echo-nl          #o100)    ; echonl: Echo nl even if echo is off
  172. (define ttyl/canonical          #o002)    ; icanon: Canonicalize input
  173. (define ttyl/enable-signals   #o001)    ; isig: Enable ^c, ^z signalling
  174. (define ttyl/extended      #o20000000000); iexten:  Enable extensions
  175. (define ttyl/ttou-signal  #o10000000000); tostop: SIGTTOU on background output
  176. (define ttyl/no-flush-on-interrupt #o200) ; noflsh
  177.  
  178. ;;; SVR4 & 4.3+BSD
  179. (define ttyl/visual-delete-line      #f)    ; echoke: visually erase a line-kill 
  180. (define ttyl/hardcopy-delete      #f)    ; echoprt: visual erase for hardcopy 
  181. (define ttyl/echo-ctl          #f)    ; echoctl: echo control chars as "^X" 
  182. (define ttyl/flush-output      #f)    ; flusho: output is being flushed
  183. (define ttyl/reprint-unread-chars #f)    ; pendin: retype pending input
  184.  
  185. ;;; 4.3+BSD
  186. (define ttyl/alt-delete-word    #f)    ; altwerase
  187. (define ttyl/no-kernel-status    #f)    ; nokerninfo: no kernel status on ^T
  188.  
  189. ;;; SVR4
  190. (define ttyl/case-map #o4)    ; xcase: canonical upper/lower presentation
  191.  
  192.  
  193. ;;; Vector of (speed . code) pairs.
  194.  
  195. (define baud-rates '#((0  . 0)        (1  . 50)    (2  .    75)
  196.               (3  . 110)    (4  . 134)    (5  .   150)
  197.               (6  . 200)    (7  . 300)    (8  .   600)
  198.               (9  . 900)    (10 . 1200)    (11 .  1800)
  199.               (12 . 2400)    (13 . 3600)    (14 .  4800)
  200.               (15 . 7200)    (16 . 9600)    (17 .  19200)
  201.               (18 . 38400)    (19 . 57600)    (20 . 115200)
  202.               (21 . 230400)    (22 . 460800)   ; 23-29 unused.
  203.               (30 . exta)    (31 . extb)))
  204.  
  205.  
  206. ;;; tcflush() constants
  207. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  208.  
  209. (define %flush-tty/input  0)    ; TCIFLUSH
  210. (define %flush-tty/output 1)    ; TCOFLUSH
  211. (define %flush-tty/both      2)    ; TCIOFLUSH
  212.  
  213.  
  214. ;;; tcflow() constants
  215. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  216.  
  217. (define %tcflow/start-out 1)    ; TCOON
  218. (define %tcflow/stop-out  0)    ; TCOOFF
  219. (define %tcflow/start-in  3)    ; TCION
  220. (define %tcflow/stop-in   2)    ; TCIOFF
  221.  
  222.  
  223. ;;; tcsetattr() constants
  224. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  225.  
  226. (define %set-tty-info/now    0)    ; TCSANOW   Make change immediately.
  227. (define %set-tty-info/drain    1)    ; TCSADRAIN Drain output, then change.
  228. (define %set-tty-info/flush    2)    ; TCSAFLUSH Drain output, flush input.
  229.